<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script type="text/javascript">
			//最大值
			let  arr = [1,5,56,6,1,1,21,45,4]
			let  max = arr[0]
			arr.forEach((item,index) => item > max ?  max = arr[index] : max)
			
			console.log(max)
			
			//最小值
			let  min = arr[0]
			arr.forEach((item,index) => item < min ?  min = arr[index] : min)
			console.log(min)
		</script>
	</body>
</html>
